package com.ikaros.concurrency.example.publish;

import com.ikaros.concurrency.annotations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;

/**
 * 发布对象线程不安全
 */
@NotThreadSafe
@Slf4j
public class PublishUnSafe {
    private String[] ikaros = {"i", "o", "u"};

    public String[] getIkaros() {
        return ikaros;
    }

    public static void main(String[] args) {
        PublishUnSafe publishUnSafe = new PublishUnSafe();
        log.info("{}", Arrays.toString(publishUnSafe.getIkaros()));
        publishUnSafe.ikaros[2] = "v";
        log.info("{}", Arrays.toString(publishUnSafe.getIkaros()));
    }
}
